import torch
"""用数字随机产生多维张量"""
"""view可和可拆"""
input = torch.rand(20*20,4,1024)
print(input.shape,input.dtype)
input = input.view(4, 1024, 20 , 20)
# input = input.transpose(2,3).contiguous() # 下标调换位置
print(input.shape,input.dtype)
"""transpose可指定下标的向量调换"""
input = torch.rand(3, 1068, 15 , 14)
input = input.transpose(2,3).contiguous()
print(input.shape,input.dtype)
input = input.view(3,1068,15*14)
print(input.shape,input.dtype)